<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>

        /* 老版构造
        function User(name,pass) {
            this.name = name;
            this.pass = pass;
        }

        User.prototype.showName = function () {
            alert(this.name);
        }
        User.prototype.showPass = function () {
            alert(this.pass);
        }
        var user = new User('小明');
        user.showName();*/

        // 面向对象--ES6写法
        class User{
        	constructor(name,pass){
		        this.name = name;
		        this.pass = pass;
            }

            showName(){
        		alert(this.name)
            }

            showPass(){
        		alert(this.pass)
            }
        }
    </script>
</head>
<body>

</body>
<script>

</script>
</html>